cmake_minimum_required(VERSION 2.8)

file(GLOB net_src "*.cpp")
file(GLOB net_protocol_src "protocol/*.c")
file(GLOB http_protocol_src "http_protocol/*.cpp")
					
if (${UNIX_OS})
	include_directories(
		${PROJECT_SOURCE_DIR}/include
		${PROJECT_SOURCE_DIR}/crt
		${PROJECT_SOURCE_DIR}/extensions/include
		${by3rd_library_include}
		/usr/local/include
		/opt/include
		/usr/include
		)

elseif (${WIN_OS})

else()

endif()

add_definitions("-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8")
add_definitions("-D__GCC_HAVE_SYNC_VAL_COMPARE_AND_SWAP_1")
add_definitions("-D__GCC_HAVE_ATOMIC_FETCH_SUB_1")
add_definitions("-D__GCC_HAVE_ATOMIC_FETCH_SUB_4")
add_definitions("-D__GCC_HAVE_ATOMIC_FETCH_ADD_1")
add_definitions("-D__GCC_HAVE_ATOMIC_FETCH_ADD_4")
add_definitions("-D__GCC_HAVE_ATOMIC_LOAD_4")


add_library(net SHARED ${net_src} ${net_protocol_src} ${http_protocol_src})

set_target_properties(net PROPERTIES OUTPUT_NAME "net")
set_target_properties(net PROPERTIES COMPILE_FLAGS ${dynamic})
set_target_properties(net PROPERTIES COMPILE_FLAGS ${compile})

target_link_libraries(net dl stdcrt)
